package com.example.helloworld;

/**
 * Created by twer on 9/28/14.
 */

class ExerciseOne {
   public void print(){
       System.out.println("*");
   }
}

class ExerciseTwo {
    int numOfAsterisks;

    public ExerciseTwo(int n){
        numOfAsterisks = n;
    }

    public void print(){
        for(int i = 0; i < numOfAsterisks; ++i){
            System.out.print("* ");
        }
        System.out.print("\n");
    }
}

class  ExerciseThree {
    int numOfAsterisks;

    public ExerciseThree(int n){
        numOfAsterisks = n;
    }

    public void print(){
        for(int i = 0; i < numOfAsterisks; ++i)
            System.out.println("*");
    }
}

class  ExerciseFour{
    int numOfAsterisks;

    public ExerciseFour(int n){
        numOfAsterisks = n;
    }

    public void print(){
        for(int i = 1; i <= numOfAsterisks; ++i){
            for(int j = 0; j < i; ++j){
                System.out.print("* ");
            }
            System.out.print("\n");
        }
    }
}

class ExerciseFive {
    int numOfAsterisks;

    public ExerciseFive(int n){
        numOfAsterisks = n;
    }

    public void print(){
        for(int i = 1; i <= numOfAsterisks; ++i){

            for(int k = 0; k < numOfAsterisks - i; ++k)
                System.out.print("  ");

            for(int j = 0; j < i * 2 - 1; ++j){
                System.out.print("* ");
            }

            System.out.print("\n");
        }
    }
}

class ExerciseSix {
    int numOfAsterisks;

    public ExerciseSix(int n){
        numOfAsterisks = n;
    }

    public void print(){
        for(int i = 1; i <= numOfAsterisks; ++i){

            for(int k = 0; k < numOfAsterisks - i; ++k)
                System.out.print("  ");

            for(int j = 0; j < i * 2 - 1; ++j){
                System.out.print("* ");
            }

            System.out.print("\n");
        }
        for(int i = numOfAsterisks - 1; i >= 0; --i){

            for(int k = i; k <= numOfAsterisks - 1; ++k)
                System.out.print("  ");

            for(int j = 0; j < i * 2 - 1; ++j){
                System.out.print("* ");
            }

            System.out.print("\n");
        }
    }
}

class ExerciseSeven {
    int numOfAsterisks;

    public ExerciseSeven(int n){
        numOfAsterisks = n;
    }

    public void print(){
        for(int i = 1; i < numOfAsterisks; ++i){

            for(int k = 0; k < numOfAsterisks - i; ++k)
                System.out.print("  ");

            for(int j = 0; j < i * 2 - 1; ++j){
                System.out.print("* ");
            }

            System.out.print("\n");
        }
        System.out.println("Amos");
        for(int i = numOfAsterisks - 1; i >= 0; --i){

            for(int k = i; k <= numOfAsterisks - 1; ++k)
                System.out.print("  ");

            for(int j = 0; j < i * 2 - 1; ++j){
                System.out.print("* ");
            }

            System.out.print("\n");
        }
    }
}




public class HelloWorld {
    public static void main(String[] args){
        System.out.println("Exercise One: ");
        ExerciseOne exerciseOne = new ExerciseOne();
        exerciseOne.print();

        System.out.println("Exercise Two: ");
        ExerciseTwo exerciseTwo = new ExerciseTwo(8);
        exerciseTwo.print();

        System.out.println("Exercise Three: ");
        ExerciseThree exerciseThree = new ExerciseThree(3);
        exerciseThree.print();

        System.out.println("Exercise Four: ");
        ExerciseFour exerciseFour = new ExerciseFour(3);
        exerciseFour.print();

        System.out.println("Exercise Five: ");
        ExerciseFive exerciseFive = new ExerciseFive(3);
        exerciseFive.print();

        System.out.println("Exercise Six: ");
        ExerciseSix exerciseSix = new ExerciseSix(5);
        exerciseSix.print();

        System.out.println("Exercise Seven: ");
        ExerciseSeven exerciseSeven = new ExerciseSeven(3);
        exerciseSeven.print();
    }
}
